package cn.zl.api.dto.streamproxy;

import cn.yunbamboos.rest.service.anno.param.ParamType;
import cn.yunbamboos.rest.service.anno.param.enums.Type;
import cn.yunbamboos.rest.service.dto.in.GenericInDTO;
import com.alibaba.fastjson2.JSONObject;
import jakarta.validation.constraints.NotNull;

public class PlayStreamProxyApiInDTO extends GenericInDTO {

    @NotNull(message = "应用名不能为空")
    @ParamType(path = "app", type = Type.String, title = "应用名", required = true, example = "app")
    private String app;
    @NotNull(message = "流名称不能为空")
    @ParamType(path = "stream", type = Type.String, title = "流名称", required = true, example = "test")
    private String stream;
    @NotNull(message = "流地址不能为空")
    @ParamType(path = "url", type = Type.String, title = "流地址", required = true, example = "rtsp://admin:admin123@192.168.0.240:8554/live0.264")
    private String url;


    @Override
    public void decode(JSONObject json) {
        super.decode(json);
        this.app = json.getString("app");
        this.stream = json.getString("stream");
        this.url = json.getString("url");
    }

    public String getApp() {
        return app;
    }

    public String getStream() {
        return stream;
    }

    public String getUrl() {
        return url;
    }
}
